class Solution(object):
    def minCount(self, coins):
        """
        :type coins: List[int]
        :rtype: int
        """
        n = 0
        for num in coins:
            if num % 2 == 1:
                n += (num+1) // 2
            else:
                n += num // 2
        return n
        # return sum((num+1)//2 if num%2==1 else num//2 for num in coins)
if __name__ == '__main__':
    coins = [4, 2, 1]
    print(Solution().minCount(coins))
# 思路：
# 时间复杂度O(n)
# 空间复杂度O(1)